package com.thiswhyme.mq.rocketmq.consumer.listener;

import com.thiswhyme.mq.rocketmq.consumer.consts.MqConsumerGroup;
import com.thiswhyme.mq.rocketmq.consumer.consts.MqDestination;
import com.thiswhyme.mq.rocketmq.consumer.dto.msg.TestMsgDto;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * Created by thiswhyme on 2020/6/7.
 */
@RocketMQMessageListener(
        topic = MqDestination.TEST_ORDERLY_TOPIC,
        consumerGroup = MqConsumerGroup.ORDERLY_CONSUMER_GROUP,
        consumeMode = ConsumeMode.ORDERLY
)
@Component
public class OrderlyMsgListener implements RocketMQListener<TestMsgDto> {

    @Override
    public void onMessage(TestMsgDto message) {
        System.out.println("监听到顺序消息：" + message.toString());
    }
}
